package com.yijiu.trb;

import android.graphics.PixelFormat;
import android.os.Bundle;
import android.text.format.Time;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.yijiu.resource.CacheData;

public class DealTextViewDialog extends BTitleActivity implements OnClickListener
{
	/**
	 * 同意
	 */
	private TextView agreeBtn;

	/**
	 * 不同意
	 */
	private TextView disAgreeBtn;

	/**
	 * 划入的金额
	 */
	private String moneyStr;

	/**
	 * 用户名
	 */
	private TextView userName;

	/**
	 * 姓名
	 */
	private TextView name0TextView;

	/**
	 * 身份证号码
	 */
	private TextView idCardNumTextView;

	/**
	 * 日期
	 */
	private TextView dateTextView;

	/**
	 * 开户名
	 */
	private TextView name1TextView;

	/**
	 * 银行帐号
	 */
	private TextView bankCardNum;

	/**
	 * 银行
	 */
	private TextView bankTextView;

	/**
	 * 划入金额
	 */
	private TextView moneyTextView;

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		getWindow().setFormat(PixelFormat.RGBA_8888);
		setContentView(R.layout.deal_text_view_dialog);
		moneyStr = getIntent().getStringExtra("monetStr");
		initWidget();
	}

	@Override
	protected void initWidget()
	{
		agreeBtn = (TextView) findViewById(R.id.deal_text_view_dialog_button_linear_layout_yes);
		agreeBtn.setOnClickListener(this);
		disAgreeBtn = (TextView) findViewById(R.id.deal_text_view_dialog_button_linear_layout_no);
		disAgreeBtn.setOnClickListener(this);
		/*------------------------------*/
		userName = (TextView) findViewById(R.id.deal_text_view_dialog_content_user_name);
		name0TextView = (TextView) findViewById(R.id.deal_text_view_dialog_content_name0);
		idCardNumTextView = (TextView) findViewById(R.id.deal_text_view_dialog_content_id_card_num);
		dateTextView = (TextView) findViewById(R.id.deal_text_view_dialog_content_date);
		name1TextView = (TextView) findViewById(R.id.deal_text_view_dialog_content_name1);
		bankCardNum = (TextView) findViewById(R.id.deal_text_view_dialog_content_bank_card_num);
		bankTextView = (TextView) findViewById(R.id.deal_text_view_dialog_content_bank_card_name);
		moneyTextView = (TextView) findViewById(R.id.deal_text_view_dialog_content_money);
		/*-------------------------------------*/
		Time time = new Time("GTM-8");
		time.setToNow();
		int monthString = time.month + 1;
		String data = time.year + "年" + monthString + "月" + time.monthDay + "日";
		/*-----------------------------------*/
		userName.setText("用户名:" + CacheData.USER_NAME);
		name0TextView.setText("姓名:" + CacheData.REAL_NAME);
		idCardNumTextView.setText("身份证号码:" + CacheData.CERT_NUM);
		dateTextView.setText("日期:" + data);
		name1TextView.setText("开户名:" + CacheData.BANK_PEOPLE_NAME);
		bankCardNum.setText("账号:" + CacheData.BANK_CARD_NUMBER);
		bankTextView.setText("开户银行:" + CacheData.BANK_CARD_NAME);
		moneyTextView.setText("划入金额:人民币" + moneyStr + "元(含第三方需收的手续费【如有】)");
	}

	@Override
	protected void leftButtonClick()
	{
		super.leftButtonClick();
		finish();
	}

	@Override
	public void onClick(View v)
	{
		switch (v.getId())
		{
			case R.id.deal_text_view_dialog_button_linear_layout_yes:// 同意
				initIntent(this, CutInCheckActivity.class, "moneyStr", moneyStr);
				break;
			case R.id.deal_text_view_dialog_button_linear_layout_no:// 不同意
				finish();
				break;
			default:
				break;
		}
	}
}
